package cn.edu.sgu.www.mhxysy.service.impl;

import cn.edu.sgu.www.mhxysy.entity.SchoolFounder;
import cn.edu.sgu.www.mhxysy.mapper.SchoolFounderMapper;
import cn.edu.sgu.www.mhxysy.service.SchoolFounderService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author heyunlin
 * @version 1.0
 */
@Service
public class SchoolFounderServiceImpl implements SchoolFounderService {

	private final SchoolFounderMapper schoolFounderMapper;

	@Autowired
	public SchoolFounderServiceImpl(SchoolFounderMapper schoolFounderMapper) {
		this.schoolFounderMapper = schoolFounderMapper;
	}

	@Override
	public List<SchoolFounder> selectAll() {
		QueryWrapper<SchoolFounder> wrapper = new QueryWrapper<>();

		return schoolFounderMapper.selectList(wrapper);
	}

	@Override
	public String selectNameById(Integer id) {
		SchoolFounder founder = schoolFounderMapper.selectById(id);

		return founder != null ? founder.getName() : "";
	}

}